package com.onlineMIS.action.headQ.ipad;

import com.onlineMIS.ORM.DAO.headQ.barCodeGentor.ProductBarcodeDaoImpl;
import com.onlineMIS.ORM.entity.headQ.barcodeGentor.Color;
import com.onlineMIS.ORM.entity.headQ.barcodeGentor.Product;
import com.onlineMIS.ORM.entity.headQ.barcodeGentor.ProductBarcode;
import com.onlineMIS.common.Common_util;

public class ProductBarcodeVO {
	private int id;
	private String barcode;
	private String brand;
	private String productCode;
	private String factoryCode;
	private int numPerHand;
	private String color;
	private String size;
	private String wholeSalePrice;
	// 精算库存
	private int inventory;
	// 实际库存
	private int inventory2;
	private int orderHis;
	// 历史选择：PDA草稿状态数量
	private int orderHisSelect;
	private int orderCurrent;
	private String category;
	private String picURL;
	// 公司货号
	private String productIdentity;

	/** 批发价 */
	private double wholesale;
	/**
	 * the chain store's sale price千禧连锁店零售价
	 */
	private double salesPrice;

	public ProductBarcodeVO(ProductBarcode pb, int inventory, int orderHis, int orderCurrent, int inventory2) {
		this.setId(pb.getId());
		this.setBarcode(pb.getBarcode());

		Product product = pb.getProduct();
		this.setProductCode(product.getProductCode());
		this.setNumPerHand(product.getNumPerHand());
		this.setWholeSalePrice(String.valueOf((int) ProductBarcodeDaoImpl.getWholeSalePrice(pb)));
		this.setBrand(product.getBrand().getBrand_Name());

		Color color = pb.getColor();
		if (color == null)
			this.setColor("");
		else
			this.setColor(color.getName());

		this.setInventory(inventory);
		this.setInventory2(inventory2);
		this.setOrderCurrent(orderCurrent);
		this.setOrderHis(orderHis);
		this.setCategory(product.getCategory().getCategory_Name());
		this.setSalesPrice(pb.getProduct().getSalesPrice());
		this.setWholesale(pb.getProduct().getSalesPriceFactory() * pb.getProduct().getDiscount());
		this.setProductIdentity(product.getProductIdentity());
		this.setFactoryCode(product.getFactoryCode());
	}

	public ProductBarcodeVO() {

	}

	public String getFactoryCode() {
		return factoryCode;
	}

	public void setFactoryCode(String factoryCode) {
		this.factoryCode = factoryCode;
	}

	public String getProductIdentity() {
		return productIdentity;
	}

	public void setProductIdentity(String productIdentity) {
		this.productIdentity = productIdentity;
	}

	public int getInventory2() {
		return inventory2;
	}

	public void setInventory2(int inventory2) {
		this.inventory2 = inventory2;
	}

	public double getWholesale() {
		return wholesale;
	}

	public void setWholesale(double wholesale) {
		this.wholesale = wholesale;
	}

	public double getSalesPrice() {
		return salesPrice;
	}

	public void setSalesPrice(double salesPrice) {
		this.salesPrice = salesPrice;
	}

	public String getPicURL() {
		return picURL;
	}

	public void setPicURL(String picURL) {
		this.picURL = picURL;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public int getInventory() {
		return inventory;
	}

	public void setInventory(int inventory) {
		this.inventory = inventory;
	}

	public int getOrderHis() {
		return orderHis;
	}

	public void setOrderHis(int orderHis) {
		this.orderHis = orderHis;
	}

	public int getOrderCurrent() {
		return orderCurrent;
	}

	public void setOrderCurrent(int orderCurrent) {
		this.orderCurrent = orderCurrent;
	}

	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getBarcode() {
		return barcode;
	}

	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}

	public String getProductCode() {
		return productCode;
	}

	public void setProductCode(String productCode) {
		this.productCode = productCode;
	}

	public int getNumPerHand() {
		return numPerHand;
	}

	public void setNumPerHand(int numPerHand) {
		this.numPerHand = numPerHand;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getSize() {
		return size;
	}

	public void setSize(String size) {
		this.size = size;
	}

	public String getWholeSalePrice() {
		return wholeSalePrice;
	}

	public void setWholeSalePrice(String wholeSalePrice) {
		this.wholeSalePrice = wholeSalePrice;
	}

	public int getOrderHisSelect() {
		return orderHisSelect;
	}

	public void setOrderHisSelect(int orderHisSelect) {
		this.orderHisSelect = orderHisSelect;
	}

	public String toString() {
		return brand + " " + productCode + " " + color + "<br/>" + "厂家货号  : " + factoryCode + "<br/>"+"公司货号  : " + productIdentity + "<br/>" + "类型  : "
				+ category + "<br/>" + "批发价  : " + wholeSalePrice + "<br/>" +
				// "精算库存 : " + inventory + "<br/>" +
				"实际库存          : " + inventory2 + "<br/>" + "历史发货 : " + orderHis + "<br/>" + "历史选货 : " + orderHisSelect
				+ "<br/>" + "当前已订 : " + orderCurrent;
	}
}
